<!--{include(pe_tpl('header.html'));}-->
<div class="content">
	<div class="now">{$nowpath}</div>
	<div class="pro_left">
		<div id="duotu_html">
			<div class="proimg jqzoom MagnifierMain">
				<img src="{pe_thumb($info['product_logo'], 381,381 )}" jqimg="{pe_thumb($info['product_logo'])}" width="381" height="381" />
				<!--{if($info['product_hd_tag']):}--><div class="{huodong_tag($info['product_hd_tag'])}">{$info['product_hd_tag']}</div><!--{endif;}-->	
			</div>
			<div class="clear"></div>
			<span class="spe_leftBtn" style="display:none">&lt;</span>
			<span class="spe_rightBtn" style="display:none">&gt;</span>
			<!--{if(count($album_list)):}-->
			<div class="spec-items"> 
				<ul>
				<!--{foreach($album_list as $k=>$v):}-->
				<li <!--{if($k==0):}-->class="on"<!--{endif;}-->><img src="{pe_thumb($v, 400, 400)}" bigimg="{pe_thumb($v)}" /></li>
				<!--{endforeach;}-->
				</ul>
			</div>
			<!--{endif;}-->
		</div>
		<div class="clear"></div>
	</div>
	<div class="fl proinfo">
		<h3>{$info['product_name']}</h3>
		<!--{if($info['product_hd_tag']):}-->
		<div class="hd_box">
			<span class="fl ico_hd">{$info['product_hd_tag']}</span>
			<span class="fr font13">距离结束：<span id="huodong_time"></span></span>
			<div class="clear"></div>
		</div>
		<!--{endif;}-->
		<div class="proinfo_box">
			<table width="100%" border="0" cellspacing="0" cellpadding="0">
			<tr>
				<td>市场价</td>
				<td><s class="num">¥ <span id="product_mmoney">{$info['product_mmoney']}</span></s></td>
			</tr>
			<tr>
				<td valign="top" width="60"><p class="mat5">商城价</p></td>
				<td><span class="jg_price fl mat5"><span class="normal">¥</span> <span id="product_money">{$info['product_money']}</span></span></td>
			</tr>
			</table>
			<div class="proinfo_r">
				<ul>
				<li><span class="font16 c333">{$info['product_commentnum']}</span><p class="mat5">累计评价</p></li>
				<li style="border-right:0"><span class="font16 c333">{$info['product_sellnum']}</span><p class="mat5">已售出</p></li>
				</ul>
			</div>
		</div>
		<table width="100%" border="0" cellspacing="0" cellpadding="0">
		<!--{if(count($quan_list)):}-->
		<tr>
			<td>优惠券</td>
			<td>
				<!--{foreach($quan_list as $v):}-->
				<span class="yh_tb">{$v['quan_money']}元 <a href="{pe_url('quan-'.$v['quan_key'])}" title="{$v['quan_name']}" target="_blank" class="cblue">领取</a></span>
				<!--{endforeach;}-->
			</td>
		</tr>
		<!--{endif;}-->
		<tr>
			<td width="60">运 费</td>
			<td>
				<!--{if($info['product_wlmoney'] == 0):}-->包邮<!--{else:}--><span class="num">¥ {$info['product_wlmoney']}</span><!--{endif;}-->
			</td>
		</tr>
		<!--{if($info['product_point']):}-->
		<tr>
			<td width="60">赠 送</td>
			<td>
				<span class="num mar5">{$info['product_point']}</span>积分
			</td>
		</tr>
		<!--{endif;}-->
		<tr>
			<td style="color:#666">评 分</td>
			<td>
				<div class="fl mat2">{pe_comment($comment_star)}</div>
				<span class="fl mal5 corg">{$comment_star} 分</span>
				<div class="clear"></div>
			</td>
		</tr>
		<!--{foreach($rule_list as $k=>$v):}-->
		<tr>
			<td><div class="mab5">{$v['name']}</div></td>
			<td class="js_rule">			
			<!--{foreach($v['list'] as $kk=>$vv):}-->
			<span rule_id="{$v['id']}" ruledata_id="{$vv['id']}" class="js_ruledata prorule_span">{$vv['name']}</span>
			<!--{endforeach;}-->
			</td>
		</tr>
		<!--{endforeach;}-->
		<tr>
			<td>数 量</td>
			<td class="shuliang">
				<input type="hidden" name="prorule_key" />
				<span class="img1" onclick="pe_numchange('product_num', '-', 1);">-</span>
				<div class="shuliang_box"><input type="text" name="product_num" value="1" /></div>
				<span class="img2" onclick="pe_numchange('product_num', '+', 999999);">+</span>
				<span class="fl c999 mal10 mat3 font12">（库存<span id="product_num">{$info['product_num']}</span>件）</span>
			</td>
		</tr>
		<tr>
			<td>&nbsp;</td>
			<td>
				<!--{if($info['product_state']==2):}-->
				<div class="jiagwc_1"><i></i>商品已下架</div>
				<!--{else:}-->
				<a href="javascript:cart_add('{$info['product_id']}');" class="fl jiagwc"><i></i>加入购物车</a>
				<!--{endif;}-->
				<a href="javascript:collect_add('{$info['product_id']}');" class="sctj fl">收藏<span class="c888 font13" id="js_collectnum">（{$info['product_collectnum']}）</span></a>
			</td>
		</tr>
		</table>
		<div class="clear"></div>
	</div>
	<div class="proview_tj">
		<div class="proview_tjtt">
			<i></i>
			<span>新品推荐</span>
		</div>
		<!--{foreach($product_newlist as $v):}-->
		<div class="mat5">
			<a href="{pe_url('product-'.$v['product_id'])}" title="{$v['product_name']}" target="_blank"><img src="{$pe['host_tpl']}images/pixel.gif" data-url="{pe_thumb($v['product_logo'], 200, 200)}" title="{$v['product_name']}" width="140" height="140" class="js_imgload" /></a>
		</div>
		<p class="center font14 num">¥{$v['product_money']}</p>
		<p class="proview_tjname"><a href="{pe_url('product-'.$v['product_id'])}" title="{$v['product_name']}" target="_blank">{$v['product_name']}</a></p>
      	<!--{endforeach;}-->
        <div class="clear"></div>
	</div>
	<div class="clear"></div>
	<div class="mat10"></div>
	<!--{include(pe_tpl('product_left.html'));}-->
	<div class="fr xiangqing">
		<div class="caidan1" id="js_menu">
			<ul class="fl">
				<li class="sel"><a href="javascript:;">商品详情</a><i></i></li>
				<li><a href="javascript:;">用户评价({$info['product_commentnum']})</a><i></i></li>
			</ul>
			<!--<div class="fr c666 mat10 mar10">商品货号：{$info['product_mark']}</div>-->
			<div class="clear"></div>
		</div>
		<!--详情 Start-->
		<div class="promain js_menuhtml">{$info['product_text']}</div>
		<!--详情 end-->
		<!--评论 Start-->
		<div class="promain js_menuhtml" style="display:none">
			<div class="plrate">
				<div class="plrate_l fl"><strong>{$comment_rate_hao}%</strong><p class="c888 mat3">好评度</p></div>
				<div class="plrate_m fl">
					<dl><dt>好评 <span class="c888">({$comment_rate_hao}%)</span></dt><dd><div style="width:{$comment_rate_hao*2}px;"></div></dd><div class="clear"></div></dl>
					<dl><dt>中评 <span class="c888">({$comment_rate_zhong}%)</span></dt><dd><div style="width:{$comment_rate_zhong*2}px;"></div></dd><div class="clear"></div></dl>
					<dl><dt>差评 <span class="c888">({$comment_rate_cha}%)</span></dt><dd><div style="width:{$comment_rate_cha*2}px;"></div></dd><div class="clear"></div></dl>
				</div>
				<div class="plrate_r">
					购买过该商品的用户可以进行评价
					<div class="mat8"><a href="{$pe['host_root']}user.php?mod=order&state=success" target="_blank">发表评价<span class="font12 normal mal5">{$comment_point}</span></a></div>
				</div>
				<div class="clear"></div>
			</div>
			<div class="plmenu" id="js_commentmenu">
				<a href="javascript:;" val="0" class="sel"><label><input name="comment_rate" type="radio" class="mar5">全部({$info['product_commentnum']})</label></a>
				<a href="javascript:;" val="hao"><label><input name="comment_rate" type="radio" class="mar5">好评({intval($comment_ratearr[0])})</label></a>
				<a href="javascript:;" val="zhong"><label><input name="comment_rate" type="radio" class="mar5">中评({intval($comment_ratearr[1])})</label></a>
				<a href="javascript:;" val="cha"><label><input name="comment_rate" type="radio" class="mar5">差评({intval($comment_ratearr[2])})</label></a>
			</div>
			<div id="js_commenthtml">
				<script type="text/html" id="js_commenttpl">
				{{each list as v k}}
				<div class="pingjia font14">{{v.comment_text}}</div>
				<ul class="plmain_ul">
					<li class="fl cblue" style="width:50px; height:30px; line-height:30px; overflow:hidden;">
						{{v.user_name}} 
					</li>
					<li class="fl mal10 c888">{{v.comment_atime}}</li>
					<li class="fr mat3">{{v.comment_star}}</li>
				</ul>
				{{/each}}
				<div class="fenye mat10">{{page}}<div class="clear"></div></div>					
				</script>
			</div>
		</div>
		<!--评论 End-->
	</div>
</div>
<link type="text/css" rel="stylesheet" href="{$pe['host_root']}include/plugin/jqzoom/style.css" />
<script type="text/javascript" src="{$pe['host_root']}include/plugin/jqzoom/jquery.jqzoom.js"></script>
<link type="text/css" rel="stylesheet" href="{$pe['host_root']}include/plugin/duotu/duotu.css" />
<script type="text/javascript" src="{$pe['host_root']}include/plugin/duotu/duotu.js"></script>
<script type="text/javascript">
var menu_top = $("#js_menu").offset().top;
template.config('escape', false);
$(function(){
	<!--{if(count($album_list)):}-->
	MagnifierF("duotu_html");
	<!--{endif;}-->
	$(".jqzoom").jqueryzoom();
	$(":input[name='product_num']").keyup(function(){
		if (!$(this).val().match(/^[1-9]+[0-9]*$/)) $(this).val(1);
	})
	pe_countdown("huodong_time", "{$info['product_hd_etime']}");
	//标签切换
	$("#js_menu").find("li").click(function(){
		var num = $(this).index();
		$("#js_menu li").removeClass("sel").eq(num).addClass("sel");
		$(".js_menuhtml").hide().eq(num).show();
		if (num == 1) {
			comment_page(1);
		}
		else if(num == 2) {
			ask_page(1);
		}
		else {
			$("body,html").scrollTop(menu_top);	
		}
	})
	//评价切换
	$("#js_commentmenu").find("a").click(function(){
		$("#js_commentmenu").find("a").removeClass("sel");
		$(this).addClass("sel");
		comment_page(1);
	})
	//规格选择
	$(".js_ruledata").click(function(){
		if ($(this).hasClass("prorule_lock")) return;
		if ($(this).hasClass("prorule_sel")) {
			$(this).removeClass("prorule_sel");
		}
		else {
			$(this).parent(".js_rule").find(".js_ruledata").removeClass("prorule_sel");
			$(this).addClass("prorule_sel");
		}
		prorule_check();
	})
})
//收藏商品
function collect_add(id) {
	pe_getinfo("{$pe['host_root']}index.php?mod=product&act=collect&id="+id, function(json){
		$("#js_collectnum").html('（' + json.num + '）');
	});
}
//评价翻页
function comment_page(page){
	var star = $("#js_commentmenu").find(".sel").attr("val");
	pe_getinfo("{$pe['host_root']}index.php?mod=comment&id={$product_id}&star="+star+"&page="+page, function(json){
		$("#js_commenthtml").html(template('js_commenttpl', json));
		$("body,html").scrollTop(menu_top);
	});
}
//评价跳转
function comment_jump() {
	$("#js_menu").find("li").eq(1).click();
}
//加入购物车
function cart_add(id) {
	if ({$cache_setting['web_guestbuy']}==0 && !{pe_login('user')}) {
		window.location.href = "{$pe['host_root']}user.php?mod=do&act=login";
		return;
	}
	if ({count($rule_list)} > 0 && $(":input[name='prorule_key']").val() == '') {
		alert('请选择商品规格');
		return;
	}
	$.getJSON("{$pe['host_root']}index.php", {"mod":"order","act":"cart_add","id":id,"num":$(":input[name='product_num']").val(),"rule":$(":input[name='prorule_key']").val()},function(json){
		if (json.result == true) {
			layer.open({
				type: 1,
				title: false,
				closeBtn: 1,
				id: 'order_add',
				content: '<div class="gw"><p>商品已加入购物车！</p><a class="gw2" href="{$pe['host_root']}index.php?mod=order&act=add">去结算</a><a class="gw1" href="javascript:layer.closeAll();">继续购物</a><div class="clear"></div></div>'
			});
		}
		else {
			pe_tip(json.show);
		}
		$("#cart_num").html(json.cart_num);
	})
}
//规格检测
function prorule_check() {
	var prorule_list = {$prorule_list};
	$(".js_ruledata").each(function(){
		var sel_arr = new Array();
		var rule_id = $(this).attr("rule_id");
		var ruledata_id = $(this).attr("ruledata_id");
		sel_arr.push(ruledata_id);	
		$(".prorule_sel[rule_id!="+rule_id+"]").each(function(){
			sel_arr.push($(this).attr("ruledata_id"));
		})
		for (var i in prorule_list) {
			var match_num = 0;
			var prorule_key = prorule_list[i]['prorule_key'].split(',');
			for (id in sel_arr) {
				if (jQuery.inArray(sel_arr[id], prorule_key) >= 0) match_num++;		
			}
			if (match_num == sel_arr.length) {
				var match_result = true; 
				break;
			}
			else {
				var match_result = false;
			}
		}
		if (match_result) {
			$(this).removeClass('prorule_lock');
		}
		else {
			$(this).addClass('prorule_lock');
		}
	})
	//更新选中规格组合
	var prorule_sel = new Array();
	$(".prorule_sel").each(function(){
		prorule_sel.push($(this).attr("ruledata_id"));
	})
	var prorule_key = prorule_sel.join(',');
	$(":input[name='prorule_key']").val('');
	//循环规格选中的有效列表
	for (var i in prorule_list) {
		//如果选中规格组合完成
		if (prorule_list[i]['prorule_key'] == prorule_key) {
			$(":input[name='prorule_key']").val(prorule_key);
			$("#product_money").html(prorule_list[i]['product_money']);
			$("#product_mmoney").html(prorule_list[i]['product_mmoney']);
			$("#product_num").html(prorule_list[i]['product_num']);
		}
	}
}
</script>
<!--{include(pe_tpl('footer.html'));}-->